﻿
namespace NetROS.Tiers.Windows.Forms
{
	/// <summary>
	/// abstract KlijentOsoba typed datagridview
	/// </summary>
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	public abstract class KlijentOsobaDataGridViewBase : System.Windows.Forms.UserControl
	{	
		/// <summary> 
		/// Thrown when the current Entity changed.
		/// </summary>
		public event System.EventHandler<KlijentOsobaDataGridViewEventArgs> CurrentEntityChanged;
		
		#region Fields
				
		/// <summary> 
		/// the current entity.
		/// </summary>
		private Entities.KlijentOsoba _currentKlijentOsoba = null;
		//private Dictionary<string, string> _columnsHeaders = new Dictionary<string, string>();
		
		/// <summary> 
		/// the datagridview instance
		/// </summary>
		protected System.Windows.Forms.DataGridView uxKlijentOsobaDataGridView;
		
		/// <summary> 
		/// the errorprovider
		/// </summary>
		protected System.Windows.Forms.ErrorProvider uxKlijentOsobaErrorProvider;
		
		/// <summary> 
		/// the bindingsource
		/// </summary>
		protected System.Windows.Forms.BindingSource uxKlijentOsobaBindingSource;
		
		
		/// <summary> 
		/// the DGV column associated with the ID property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxIDDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Ime property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxImeDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Prezime property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxPrezimeDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Telefon property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxTelefonDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Mobitel property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxMobitelDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Fax property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxFaxDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Email property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxEmailDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDKlijent property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDKlijentDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDMjesto property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDMjestoDataGridViewColumn;
		
		#endregion
					
		#region Combo list
		
				
		private Entities.TList<Entities.Klijent> _IDKlijentList;
		
		/// <summary> 
		/// The list of selectable Klijent
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.Klijent> IDKlijentList
		{
			get {return this._IDKlijentList;}
			set 
			{
				this._IDKlijentList = value;
				this.uxIDKlijentDataGridViewColumn.DataSource = null;
				this.uxIDKlijentDataGridViewColumn.DataSource = this._IDKlijentList;
			}
		}
		
		private bool _allowNewItemInIDKlijentList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of Klijent
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDKlijentList
		{
			get { return _allowNewItemInIDKlijentList;}
			set
			{
				this._allowNewItemInIDKlijentList = value;
				this.uxIDKlijentDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
				
		private Entities.TList<Entities.Mjesto> _IDMjestoList;
		
		/// <summary> 
		/// The list of selectable Mjesto
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.Mjesto> IDMjestoList
		{
			get {return this._IDMjestoList;}
			set 
			{
				this._IDMjestoList = value;
				this.uxIDMjestoDataGridViewColumn.DataSource = null;
				this.uxIDMjestoDataGridViewColumn.DataSource = this._IDMjestoList;
			}
		}
		
		private bool _allowNewItemInIDMjestoList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of Mjesto
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDMjestoList
		{
			get { return _allowNewItemInIDMjestoList;}
			set
			{
				this._allowNewItemInIDMjestoList = value;
				this.uxIDMjestoDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
		#endregion
		
		#region Main Datasource
		
		private Entities.TList<Entities.KlijentOsoba> _KlijentOsobaList;
				
		/// <summary> 
		/// The list of KlijentOsoba to be displayed in the DGV.
		/// </summary>
		[System.ComponentModel.Category("Data")]
		public Entities.TList<Entities.KlijentOsoba> KlijentOsobaList
		{
			get {return this._KlijentOsobaList;}
			set
			{
				this._KlijentOsobaList = value;
				this.uxKlijentOsobaBindingSource.DataSource = null;
				this.uxKlijentOsobaBindingSource.DataSource = value;
				this.uxKlijentOsobaDataGridView.DataSource = null;
				this.uxKlijentOsobaDataGridView.DataSource = this.uxKlijentOsobaBindingSource;				
				//this.uxKlijentOsobaBindingSource.ListChanged += new System.ComponentModel.ListChangedEventHandler(uxKlijentOsobaBindingSource_ListChanged);
				this.uxKlijentOsobaBindingSource.CurrentItemChanged += new System.EventHandler(OnKlijentOsobaBindingSourceCurrentItemChanged);
			}
		}
		
		private void OnKlijentOsobaBindingSourceCurrentItemChanged(object sender, System.EventArgs e)
		{
			_currentKlijentOsoba = uxKlijentOsobaBindingSource.Current as Entities.KlijentOsoba;
			
			if (_currentKlijentOsoba != null)
			{
				_currentKlijentOsoba.Validate();
			}
			//_KlijentOsoba.Validate();
			OnCurrentEntityChanged();
		}

		//void uxKlijentOsobaBindingSource_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)
		//{
			//throw new Exception("The method or operation is not implemented.");
		//}		
		
		#endregion
		
		/// <summary>
		/// Gets the currently selected <c cref="Entities.KlijentOsoba"/> instance.
		/// </summary>
		public Entities.KlijentOsoba SelectedKlijentOsoba
		{
			get {return this._currentKlijentOsoba;}
		}
		
		#region other properties
		
		/// <summary>
		/// Gets or sets a value indicating whether you have provided your own data-management operations for the DataGridView control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool VirtualMode
		{
			get {return this.uxKlijentOsobaDataGridView.VirtualMode;}
			set
			{
				this.uxKlijentOsobaDataGridView.VirtualMode = value;
			}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the option to add rows is displayed to the user.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToAddRows
		{
			get {return this.uxKlijentOsobaDataGridView.AllowUserToAddRows;}
			set {this.uxKlijentOsobaDataGridView.AllowUserToAddRows = value;}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the user is allowed to delete rows from the DataGridView.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToDeleteRows
		{
			get {return this.uxKlijentOsobaDataGridView.AllowUserToDeleteRows;}
			set {this.uxKlijentOsobaDataGridView.AllowUserToDeleteRows = value;}
		}
		
		/// <summary>
		/// Gets the <c cref="DataGridView"/> instance.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public System.Windows.Forms.DataGridView DataGridView
		{
			get {return this.uxKlijentOsobaDataGridView;}
		}
		
		/// <summary>
		/// Gets a collection that contains all the columns in the control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]		
		[System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Visible)]
		//[System.ComponentModel.EditorAttribute("System.Windows.Forms.Design.DataGridViewColumnCollectionEditor, System.Design", typeof(System.Drawing.Design.UITypeEditor))] 
		public System.Windows.Forms.DataGridViewColumnCollection Columns
		{
			get { return this.uxKlijentOsobaDataGridView.Columns; }
		}
		
		#endregion
		
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;
	
		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}
	
		#region Constructor
	
		/// <summary>
		/// Initializes a new instance of the <see cref="KlijentOsobaDataGridViewBase"/> class.
		/// </summary>
		public KlijentOsobaDataGridViewBase()
		{			
			this.components = new System.ComponentModel.Container();			
			
			this.uxKlijentOsobaDataGridView = new System.Windows.Forms.DataGridView();
			this.uxKlijentOsobaBindingSource = new System.Windows.Forms.BindingSource(this.components);
			this.uxKlijentOsobaErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
			this.uxIDDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxImeDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxPrezimeDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxTelefonDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxMobitelDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxFaxDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxEmailDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxIDKlijentDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxIDMjestoDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			//this.uxIDKlijentBindingSource = new KlijentBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDKlijentBindingSource)).BeginInit();
			//this.uxIDMjestoBindingSource = new MjestoBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDMjestoBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxKlijentOsobaDataGridView)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxKlijentOsobaBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxKlijentOsobaErrorProvider)).BeginInit();
			this.SuspendLayout();
						
			// 
			// uxKlijentOsobaErrorProvider
			// 
			this.uxKlijentOsobaErrorProvider.ContainerControl = this;
			this.uxKlijentOsobaErrorProvider.DataSource = this.uxKlijentOsobaBindingSource;						
			// 
			// uxKlijentOsobaDataGridView
			// 
			this.uxKlijentOsobaDataGridView.AutoGenerateColumns = false;
			this.uxKlijentOsobaDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
			this.uxKlijentOsobaDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
		this.uxIDDataGridViewColumn,
		this.uxImeDataGridViewColumn,
		this.uxPrezimeDataGridViewColumn,
		this.uxTelefonDataGridViewColumn,
		this.uxMobitelDataGridViewColumn,
		this.uxFaxDataGridViewColumn,
		this.uxEmailDataGridViewColumn,
		this.uxIDKlijentDataGridViewColumn,
		this.uxIDMjestoDataGridViewColumn			});
			this.uxKlijentOsobaDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
			this.uxKlijentOsobaDataGridView.Location = new System.Drawing.Point(0, 0);
			this.uxKlijentOsobaDataGridView.Name = "uxKlijentOsobaDataGridView";
			this.uxKlijentOsobaDataGridView.Size = new System.Drawing.Size(470, 300);
			this.uxKlijentOsobaDataGridView.TabIndex = 0;	
			this.uxKlijentOsobaDataGridView.BackgroundColor = System.Drawing.Color.WhiteSmoke;
			this.uxKlijentOsobaDataGridView.EnableHeadersVisualStyles = false;
			this.uxKlijentOsobaDataGridView.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.OnKlijentOsobaDataGridViewDataError);
			this.uxKlijentOsobaDataGridView.CellValueNeeded += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnKlijentOsobaDataGridViewCellValueNeeded);
			this.uxKlijentOsobaDataGridView.CellValuePushed += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnKlijentOsobaDataGridViewCellValuePushed);
			
			//
			// uxIDDataGridViewColumn
			//
			this.uxIDDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDDataGridViewColumn.DataPropertyName = "ID";
			this.uxIDDataGridViewColumn.HeaderText = "ID";
			this.uxIDDataGridViewColumn.Name = "uxIDDataGridViewColumn";
			this.uxIDDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDDataGridViewColumn.ReadOnly = true;		
			//
			// uxImeDataGridViewColumn
			//
			this.uxImeDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxImeDataGridViewColumn.DataPropertyName = "Ime";
			this.uxImeDataGridViewColumn.HeaderText = "Ime";
			this.uxImeDataGridViewColumn.Name = "uxImeDataGridViewColumn";
			this.uxImeDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxImeDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxImeDataGridViewColumn.ReadOnly = false;		
			//
			// uxPrezimeDataGridViewColumn
			//
			this.uxPrezimeDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxPrezimeDataGridViewColumn.DataPropertyName = "Prezime";
			this.uxPrezimeDataGridViewColumn.HeaderText = "Prezime";
			this.uxPrezimeDataGridViewColumn.Name = "uxPrezimeDataGridViewColumn";
			this.uxPrezimeDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxPrezimeDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxPrezimeDataGridViewColumn.ReadOnly = false;		
			//
			// uxTelefonDataGridViewColumn
			//
			this.uxTelefonDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxTelefonDataGridViewColumn.DataPropertyName = "Telefon";
			this.uxTelefonDataGridViewColumn.HeaderText = "Telefon";
			this.uxTelefonDataGridViewColumn.Name = "uxTelefonDataGridViewColumn";
			this.uxTelefonDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxTelefonDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxTelefonDataGridViewColumn.ReadOnly = false;		
			//
			// uxMobitelDataGridViewColumn
			//
			this.uxMobitelDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxMobitelDataGridViewColumn.DataPropertyName = "Mobitel";
			this.uxMobitelDataGridViewColumn.HeaderText = "Mobitel";
			this.uxMobitelDataGridViewColumn.Name = "uxMobitelDataGridViewColumn";
			this.uxMobitelDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxMobitelDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxMobitelDataGridViewColumn.ReadOnly = false;		
			//
			// uxFaxDataGridViewColumn
			//
			this.uxFaxDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxFaxDataGridViewColumn.DataPropertyName = "Fax";
			this.uxFaxDataGridViewColumn.HeaderText = "Fax";
			this.uxFaxDataGridViewColumn.Name = "uxFaxDataGridViewColumn";
			this.uxFaxDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxFaxDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxFaxDataGridViewColumn.ReadOnly = false;		
			//
			// uxEmailDataGridViewColumn
			//
			this.uxEmailDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxEmailDataGridViewColumn.DataPropertyName = "Email";
			this.uxEmailDataGridViewColumn.HeaderText = "Email";
			this.uxEmailDataGridViewColumn.Name = "uxEmailDataGridViewColumn";
			this.uxEmailDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxEmailDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxEmailDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDKlijentDataGridViewColumn
			//
			this.uxIDKlijentDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDKlijentDataGridViewColumn.DataPropertyName = "IDKlijent";
			this.uxIDKlijentDataGridViewColumn.HeaderText = "IDKlijent";
			this.uxIDKlijentDataGridViewColumn.Name = "uxIDKlijentDataGridViewColumn";
			this.uxIDKlijentDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDKlijentDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDKlijentDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDMjestoDataGridViewColumn
			//
			this.uxIDMjestoDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDMjestoDataGridViewColumn.DataPropertyName = "IDMjesto";
			this.uxIDMjestoDataGridViewColumn.HeaderText = "IDMjesto";
			this.uxIDMjestoDataGridViewColumn.Name = "uxIDMjestoDataGridViewColumn";
			this.uxIDMjestoDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDMjestoDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDMjestoDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDKlijentDataGridViewColumn
			//				
			this.uxIDKlijentDataGridViewColumn.DisplayMember = "ImeKlijenta";	
			this.uxIDKlijentDataGridViewColumn.ValueMember = "ID";	
			this.uxIDKlijentDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDKlijentDataGridViewColumn.DataSource = uxIDKlijentBindingSource;				
				
			//
			// uxIDMjestoDataGridViewColumn
			//				
			this.uxIDMjestoDataGridViewColumn.DisplayMember = "Naziv";	
			this.uxIDMjestoDataGridViewColumn.ValueMember = "ID";	
			this.uxIDMjestoDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDMjestoDataGridViewColumn.DataSource = uxIDMjestoBindingSource;				
				
			
			// this
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			this.Controls.Add(this.uxKlijentOsobaDataGridView);
			this.Name = "KlijentOsobaDataGridView";
			this.Size = new System.Drawing.Size(470, 300);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDKlijentBindingSource)).EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.uxIDMjestoBindingSource)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxKlijentOsobaErrorProvider)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxKlijentOsobaDataGridView)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxKlijentOsobaBindingSource)).EndInit();
			this.ResumeLayout(false);
		}
		#endregion
				
		#region events
		
		/// <summary>
		/// Raised the CurrentEntityChanged event.
		/// </summary>
		protected void OnCurrentEntityChanged()
		{
			if (CurrentEntityChanged != null)
			{
				KlijentOsobaDataGridViewEventArgs args = new KlijentOsobaDataGridViewEventArgs();
				args.KlijentOsoba = _currentKlijentOsoba;
				CurrentEntityChanged(this, args); 
			}
		}
		
		#endregion
		
		/// <summary>
		/// Strongly typed event 
		/// </summary>
		public class KlijentOsobaDataGridViewEventArgs : System.EventArgs
		{
			private Entities.KlijentOsoba	_KlijentOsoba;
	
			/// <summary>
			/// the  Entities.KlijentOsoba instance.
			/// </summary>
			public Entities.KlijentOsoba KlijentOsoba
			{
				get { return _KlijentOsoba; }
				set { _KlijentOsoba = value; }
			}	
		}
		
		/// <summary>
		/// Handles the DataError event of the uxKlijentOsobaDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewDataErrorEventArgs"/> instance containing the event data.</param>
		protected void OnKlijentOsobaDataGridViewDataError(object sender, System.Windows.Forms.DataGridViewDataErrorEventArgs e)
		{
			System.Diagnostics.Debug.WriteLine(string.Format( "{0}, {1}", e.ColumnIndex, e.RowIndex));
		}
		
		/// <summary>
		/// Handles the CellValueNeeded event of the uxKlijentOsobaDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnKlijentOsobaDataGridViewCellValueNeeded(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxKlijentOsobaDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDDataGridViewColumn":
						e.Value = KlijentOsobaList[e.RowIndex].ID;
						break;
					case "uxImeDataGridViewColumn":
						e.Value = KlijentOsobaList[e.RowIndex].Ime;
						break;
					case "uxPrezimeDataGridViewColumn":
						e.Value = KlijentOsobaList[e.RowIndex].Prezime;
						break;
					case "uxTelefonDataGridViewColumn":
						e.Value = KlijentOsobaList[e.RowIndex].Telefon;
						break;
					case "uxMobitelDataGridViewColumn":
						e.Value = KlijentOsobaList[e.RowIndex].Mobitel;
						break;
					case "uxFaxDataGridViewColumn":
						e.Value = KlijentOsobaList[e.RowIndex].Fax;
						break;
					case "uxEmailDataGridViewColumn":
						e.Value = KlijentOsobaList[e.RowIndex].Email;
						break;
					case "uxIDKlijentDataGridViewColumn":
						e.Value = KlijentOsobaList[e.RowIndex].IDKlijent;
						break;
					case "uxIDMjestoDataGridViewColumn":
						e.Value = KlijentOsobaList[e.RowIndex].IDMjesto;
						break;
				default:
				break;
			}
		}
		
		/// <summary>
		/// Handles the CellValuePushed event of the uxKlijentOsobaDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnKlijentOsobaDataGridViewCellValuePushed(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxKlijentOsobaDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDDataGridViewColumn":
						KlijentOsobaList[e.RowIndex].ID = (System.Int32)e.Value;
						break;
					case "uxImeDataGridViewColumn":
						KlijentOsobaList[e.RowIndex].Ime = (System.String)e.Value;
						break;
					case "uxPrezimeDataGridViewColumn":
						KlijentOsobaList[e.RowIndex].Prezime = (System.String)e.Value;
						break;
					case "uxTelefonDataGridViewColumn":
						KlijentOsobaList[e.RowIndex].Telefon = (System.String)e.Value;
						break;
					case "uxMobitelDataGridViewColumn":
						KlijentOsobaList[e.RowIndex].Mobitel = (System.String)e.Value;
						break;
					case "uxFaxDataGridViewColumn":
						KlijentOsobaList[e.RowIndex].Fax = (System.String)e.Value;
						break;
					case "uxEmailDataGridViewColumn":
						KlijentOsobaList[e.RowIndex].Email = (System.String)e.Value;
						break;
					case "uxIDKlijentDataGridViewColumn":
						KlijentOsobaList[e.RowIndex].IDKlijent = (System.Int32)e.Value;
						break;
					case "uxIDMjestoDataGridViewColumn":
						KlijentOsobaList[e.RowIndex].IDMjesto = (System.Int32?)e.Value;
						break;
				default:
				break;
			}
		}
	}
}
